package ch06;
import org.apache.logging.log4j.*;

import java.util.Scanner;

public class ArrayMain {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
//        System.out.println(String.class.getName());
//        System.out.println(Scanner.class.getName());
//        System.out.println(ArrayMain.class.getName());
        Logger logger =
                LogManager.getLogger(ArrayMain.class.getName());//获取Logger对象
        int[] arr = new int[5];
        try {
            for (int i = 0; i < 10; i++) {
                arr[i] = i + 1;
                System.out.println(" 下标为" + i + "的数值为：" + arr[i]);
                logger.trace(" 下标为" + i + "的元素已成功赋值！");
            }
        } catch (ArrayIndexOutOfBoundsException ex) {
            logger.error("数组下标越界啦！");
        } finally {
            System.out.println("感谢使用本程序！");
        }
	}

}
